<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<html>
<head>
    <meta charset="utf-8">
    <title>图形图像处理交流网站</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="icon" href="${pageContext.request.contextPath}/img/fav.ico" type="image/x-icon" />
    <link rel="shortcut icon" href="${pageContext.request.contextPath}/img/fav.ico" type="image/x-icon" />
    <link rel="bookmark" href="${pageContext.request.contextPath}/img/fav.ico" type="image/x-icon" />

    <link rel="stylesheet" href="${pageContext.request.contextPath}/layui/css/layui.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/global.css">
    <script type="text/javascript" charset="utf-8" src="${pageContext.request.contextPath}/ueditor/ueditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="${pageContext.request.contextPath}/ueditor/ueditor.all.min.js"> </script>
    <!--建议手动加在语言，避免在ie下有时因为加载语言失败导致编辑器加载失败-->
    <!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
    <script type="text/javascript" charset="utf-8" src="${pageContext.request.contextPath}/ueditor/lang/zh-cn/zh-cn.js"></script>
    <style>
        .layui-form-select dl {
            z-index: 9999;
        }
    </style>
</head>
<body>

<!--头部导航开始-->
<form action="${pageContext.request.contextPath}/fileInfo/listKey.do" method="get">
    <input type="hidden" name="currentPage" value="1">
    <div class="fly-header layui-bg-black">
        <div class="layui-container">
            <ul class="layui-nav">
                <li class="layui-nav-item">
                    <a href="${pageContext.request.contextPath}/blog/index.do">首页</a>
                </li>
                <li class="layui-nav-item "><a href="${pageContext.request.contextPath}/fileInfo/to_list.do?currentPage=1">下载</a></li>
                <li class="layui-nav-item">
                    <a href="${pageContext.request.contextPath}/blog/list.do?currentPage=1">博客分类</a>
                    <dl class="layui-nav-child">
                        <c:forEach items="${types}" var="types">
                            <dd><a href="${pageContext.request.contextPath}/blog/typelist.do?currentPage=1&tId=${types.tId}">${types.tName}</a></dd>
                        </c:forEach>
                    </dl>
                </li>
                <li class="layui-nav-item layui-hide-xs" style="width: 11%;">

                </li>
                <li class="layui-nav-item layui-hide-xs" style="width: 25%;">
                    <input type="text" name="title"  placeholder="请输入关键字" autocomplete="off" class="layui-input">
                </li>
                <%--
                <input type="submit" name="select" value="搜索" style="margin-left: 10px;" class="layui-btn layui-btn-radius">
                --%>
                <button type="submit" name="select"  style="margin-left: 10px;" class="layui-btn layui-btn-radius layui-hide-xs" lay-submit>搜索</button>

                <li class="layui-nav-item layui-hide-xs">
                    <a href="${pageContext.request.contextPath}/blog/to_add.do">写博客<i class="layui-icon">&#xe642;</i></a>
                </li>
            </ul>

            <ul class="layui-nav fly-nav-user">
                <c:if test="${user==null}">
                    <!-- 未登入的状态 -->
                    <li class="layui-nav-item">
                        <a class="iconfont icon-touxiang layui-hide-xs" href="${pageContext.request.contextPath}/user/to_login.do"></a>
                    </li>
                    <li class="layui-nav-item">
                        <a href="${pageContext.request.contextPath}/user/to_login.do">登入</a>
                    </li>
                    <li class="layui-nav-item">
                        <a href="${pageContext.request.contextPath}/user/to_register.do">注册</a>
                    </li>
                    <!-- 未登入的状态结束 -->
                </c:if>
                <c:if test="${user!=null}">
                    <!-- 登入的状态开始 -->
                    <li class="layui-nav-item">
                        <a class="fly-nav-avatar" href="javascript:;">
                            <cite class="layui-hide-xs">${user.userName}</cite>
                            <img src="${pageContext.request.contextPath}${user.uImage}">
                        </a>
                        <dl class="layui-nav-child">
                            <c:if test="${user.uType=='admin'}">
                                <dd><a href="${pageContext.request.contextPath}/admin/index.do"><i class="layui-icon" style="font-size: 18px;">&#xe64a;</i>后台管理</a></dd>
                            </c:if>
                            <dd><a href="${pageContext.request.contextPath}/blog/student/to_list.do?currentPage=1"><i class="layui-icon" style="font-size: 18px;">&#xe653;</i>我的博客</a></dd>
                            <dd><a href="${pageContext.request.contextPath}/fileInfo/student/to_list.do?currentPage=1"><i class="layui-icon" style="font-size: 18px;">&#xe60a;</i>我的文件</a></dd>
                            <dd><a href="${pageContext.request.contextPath}/blog/student/to_studentSet.do"><i class="layui-icon" style="font-size: 18px;">&#xe620;</i>基本设置</a></dd>
                            <dd><a href="${pageContext.request.contextPath}/blog/to_home.do?uId=${user.uId}"><i class="layui-icon" style="margin-left: 2px; font-size: 18px;">&#xe68e;</i>我的主页</a></dd>
                            <c:if test="${user.uType=='老师'}">
                                <dd><a href="${pageContext.request.contextPath}/lunbo/teacher/tolunbo.do"><i class="layui-icon" style="font-size: 18px;">&#xe64a;</i>轮播图管理</a></dd>
                                <dd><a href="${pageContext.request.contextPath}/type/teacher/list.do"><i class="layui-icon" style="font-size: 18px;">&#xe66e;</i>博客分类</a></dd>
                            </c:if>
                            <hr style="margin: 2px 0;">
                            <dd><a href="${pageContext.request.contextPath}/user/logout.do" style="text-align: center;">退出</a></dd>
                        </dl>

                    </li>
                    <!-- 登入的状态结束 -->
                </c:if>
            </ul>
        </div>
    </div>
</form>
<!--头部导航结束-->
<!-- 占位 -->
<div class="fly-panel ">
<%--所有文件列表--%>
<div class="layui-container">
    <div class="layui-row ">
            <div class="fly-panel" style="margin-bottom: 0;">
                <c:if test="${flist.size()!=0}">
                    <ul class="fly-list">
                        <c:forEach items="${flist}" var="file">
                            <li>
                                <a href="${pageContext.request.contextPath}/fileInfo/to_fileInfo.do?fId=${file.fId}" class="fly-avatar">
                                    <img src="${pageContext.request.contextPath}${file.fTypeImage}">
                                </a>
                                <h2>
                                    <a href="${pageContext.request.contextPath}/fileInfo/to_fileInfo.do?fId=${file.fId}">${file.fName}</a>
                                </h2>
                                <div class="fly-list-info">
                                    <a href="${pageContext.request.contextPath}/blog/to_home.do?uId=${file.user.uId}" link>
                                        <cite>上传者：</cite>
                                        <cite>${file.user.uNickName}</cite>
                                    </a>
                                    <span>上传日期：</span>
                                    <span><spring:eval expression="file.fCreateTime"/></span>
                                </div>
                            </li>
                        </c:forEach>
                    </ul>
                    <%--分页--%>
                    <form action="${pageContext.request.contextPath}/fileInfo/listKey.do" method="get">
                        <input type="hidden" name="title" value="${key}">
                        <div style="text-align: center">
                            <div class="laypage-main">
                                <c:if test="${pageInfo.hasPrePage}">
                                    <a href="${pageContext.request.contextPath}/fileInfo/listKey.do?currentPage=1&title=${key}">首页</a>
                                    <a href="${pageContext.request.contextPath}/fileInfo/listKey.do?currentPage=${pageInfo.currentPage-1}&title=${key}">上一页</a>
                                </c:if>
                                <c:if test="${pageInfo.hasPrePage==false}">
                                    <span>首页</span>
                                    <span>上一页</span>
                                </c:if>
                                <c:choose>
                                    <c:when test="${pageInfo.totalPage>5}">
                                        <c:forEach var="count" begin="1" end="5">
                                            <c:if  test="${pageInfo.currentPage==count}">
                                                <a href="${pageContext.request.contextPath}/fileInfo/listKey.do?currentPage=${count}&title=${key}" class="laypage-curr">${count}</a>
                                            </c:if>
                                            <c:if test="${pageInfo.currentPage!=count}">
                                                <a href="${pageContext.request.contextPath}/fileInfo/listKey.do?currentPage=${count}&title=${key}">${count}</a>
                                            </c:if>
                                        </c:forEach>
                                        <span>…</span>
                                    </c:when>
                                    <c:when test="${pageInfo.totalPage<=5}">
                                        <c:forEach var="count" begin="1" end="${pageInfo.totalPage}">
                                            <c:if test="${pageInfo.currentPage!=count}">
                                                <a href="${pageContext.request.contextPath}/fileInfo/listKey.do?currentPage=${count}&title=${key}">${count}</a>
                                            </c:if>
                                            <c:if  test="${pageInfo.currentPage==count}">
                                                <a href="${pageContext.request.contextPath}/fileInfo/listKey.do?currentPage=${count}&title=${key}" class="laypage-curr">${count}</a>
                                            </c:if>
                                        </c:forEach>
                                    </c:when>
                                </c:choose>

                                <c:if test="${pageInfo.hasNextPage}">
                                    <a href="${pageContext.request.contextPath}/fileInfo/listKey.do?currentPage=${pageInfo.currentPage+1}&title=${key}">下一页</a>
                                    <a href="${pageContext.request.contextPath}/fileInfo/listKey.do?currentPage=${pageInfo.totalPage}&title=${key}">尾页</a>
                                </c:if>
                                <c:if test="${pageInfo.hasNextPage==false}">
                                    <span> 下一页</span>
                                    <span> 尾页</span>
                                </c:if>
                            </div>
                            <div class="laypage-main" >
                                <cite> 共${pageInfo.totalPage}页</cite>
                            </div>
                            <span style="height: 100%; text-align: center;">
                        <div class="layui-inline" style="margin-top: 20px;margin-left: 2px; margin-right: 2px;">
                            <cite>到第</cite>
                            <div class="layui-input-inline" style="width: 50px;">
                              <input type="text" name="currentPage" autocomplete="off" class="layui-input">
                            </div>
                            <cite>页</cite>
				        </div>
                        <button type="submit" class="layui-btn" style="margin-top: 20px;">确定</button>
		            </span>
                            <div style="height: 10px;"></div>
                        </div>
                    </form>
                    <%--分页结束--%>
                </c:if>
                <c:if test="${flist.size()==0}">
                    <div class="fly-none"><img src="${pageContext.request.contextPath}/img/none.png"><h2>没有相关数据</h2></div>
                </c:if>
            </div>
    </div>
</div>
<jsp:include page="bottom.jsp"/>
